package com.zmn.plat.common.dictionary;

/**
 * 渠道押金/保证金
 *
 * @author yangshuangping
 * @since 2021-7-1 18:07:17
 */
public enum ChannelDepositTypeEnum {

    RECHARGE(ChannelDepositTypeEnum.CHANNEL_DEPOSIT_TYPE_RECHARGE, "收款"),
    REFUND(ChannelDepositTypeEnum.CHANNEL_DEPOSIT_TYPE_REFUND, "退款"),
    DEDUCTION(ChannelDepositTypeEnum.CHANNEL_DEPOSIT_TYPE_DEDUCTION, "扣款");

    /**
     * 描述: 渠道押金/保证金 收款
     */
    public static final int CHANNEL_DEPOSIT_TYPE_RECHARGE = 1;

    /**
     * 描述: 渠道押金/保证金 退款
     */
    public static final int CHANNEL_DEPOSIT_TYPE_REFUND = 2;

    /**
     * 描述: 渠道押金/保证金 扣款
     */
    public static final int CHANNEL_DEPOSIT_TYPE_DEDUCTION = 3;

    private Integer code;
    private String name;

    ChannelDepositTypeEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static String getName(Integer code) {
        ChannelDepositTypeEnum of = of(code);
        return of == null ? null : of.getName();
    }

    public static ChannelDepositTypeEnum of(Integer code) {
        switch (code) {
            case 1:
                return RECHARGE;
            case 2:
                return REFUND;
            case 3:
                return DEDUCTION;
            default:
                return null;
        }
    }
}
